﻿<shared:PageBase x:Class="Bymed.SpineScan.WPF.DeviceConfigurationPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Bymed.SpineScan.WPF.Shared"
      mc:Ignorable="d" 
      x:Name="CurrentPage" 
      d:DesignHeight="1000" d:DesignWidth="1280"
	  Title="DeviceConfigurationPage" Style="{StaticResource DefaultPageStyle}" 
      DataContext="{Binding DeviceConfiguration, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="{x:Type ComboBox}">
                <Setter Property="FontSize" Value="16" />
                <Setter Property="Width" Value="120" />
                <Setter Property="IsReadOnly" Value="True" />
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="VerticalAlignment" Value="Top" />
            </Style>
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <!-- Main Content -->
            <RowDefinition Height="Auto" />
            <!-- Navigation Buttons -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.Background>
                <ImageBrush ImageSource="/Skins/Resource/Image/GrayRightAboveTabBackground.png" />
            </Grid.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <!-- Page Title -->
                    <RowDefinition Height="55" />
                    <!-- Data Management Functions -->
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="注册许可" Margin="0,15,40,0" HorizontalAlignment="Right" Style="{StaticResource PageTitleTextBlock}" />
                <Grid Grid.Row="1" Margin="20,0,20,0" Height="500">
                    <Border Margin="0,0,0,15" Grid.Row="1" Style="{StaticResource OperationPortionBorder}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="120" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <!-- Title -->
                                <RowDefinition Height="Auto" />
                                <!-- Serial Port Number -->
                                <RowDefinition Height="Auto" />
                                <!-- Computer Number -->
                                <RowDefinition Height="Auto" />
                                <!-- Registration Code -->
                                <RowDefinition Height="Auto" />
                                <!-- Available Authorised Usage Count -->
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <TextBlock Grid.ColumnSpan="2" Margin="0,0,0,10" Text="注册许可" Style="{StaticResource InfoTextBlock}" />
                            <TextBlock Grid.Row="1" Text="COM端口" Margin="0,0,0,20" Style="{StaticResource TestReportTextBlock}" />
                            <ComboBox Grid.Column="1" Grid.Row="1" ItemsSource="{Binding SerialPortNameList}" SelectedValue="{Binding SerialPortName}" />
                            <TextBlock Grid.Row="2" Text="电脑编号" Margin="0,0,0,20" Style="{StaticResource TestReportTextBlock}" />
                            <TextBox Grid.Column="1" Grid.Row="2" IsReadOnly="True" Text="{Binding ComputerNumber}" Width="120" Height="30" Style="{StaticResource RegularTextBox}" />
                            <TextBlock Grid.Row="3" Text="注册码" Margin="0,0,0,20" Style="{StaticResource TestReportTextBlock}" />
                            <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding RegistrationCode, UpdateSourceTrigger=PropertyChanged}" Width="300" Height="80" 
                                     Margin="0,0,0,20" TextWrapping="Wrap" FontFamily="Consolas" Style="{StaticResource RegularTextBox}" />
                            <TextBlock Grid.Row="4" Text="可用次数" Style="{StaticResource TestReportTextBlock}" />
                            <TextBlock Grid.Column="1" Grid.Row="4" Text="{Binding AvailableAuthorisedUsage}" Style="{StaticResource TestReportTextBlock}" />
                        </Grid>
                    </Border>
                </Grid>
            </Grid>
        </Grid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="保存并重启" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Save.png" Style="{StaticResource NavigationButton}" Command="{Binding SaveCommand}" />
            <Button Content="取消并返回" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Cancel.png" Style="{StaticResource NavigationButton}" Click="ButtonCancel_Click" />
        </StackPanel>
    </Grid>
</shared:PageBase>
